Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default API URL to Current Host in Production #42

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

mbsantiago
Copy link
Owner

This PR addresses the issue of hardcoding the backend API URL in the frontend code. To ensure flexibility across environments, the following changes have been implemented:

  • Production: The API URL now defaults to the current host (empty string). This is because the same server handles both the frontend and backend in production.
  • Development: The API URL is determined dynamically:
    • Priority is given to the NEXT_PUBLIC_BACKEND_HOST environment variable if it's set.
    • If the environment variable is not set, a default development URL is used.

This approach ensures that the frontend correctly targets the API in both production and development environments.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.47%. Comparing base (ec406fa) to head (38c03dc).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #42   +/-   ##
=======================================
  Coverage   66.47%   66.47%           
=======================================
  Files         179      179           
  Lines        8367     8367           
=======================================
  Hits         5562     5562           
  Misses       2805     2805           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mbsantiago mbsantiago merged commit 351ff06 into main Nov 8, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant